using UnityEngine;
using System.Collections;

public class BulletBehaviour : MonoBehaviour {

	// Use this for initialization

    public float m_LifeTime = 1.0f;
    private float m_DeathTime = 0;

    void Start()
    {

    }
	
    //// Update is called once per frame
    void Update()
    {
        m_DeathTime += Time.deltaTime;

        if (m_DeathTime > m_LifeTime)
        {
            Destroy(this.gameObject);
            m_DeathTime = 0;
        }
    }

    void OnTriggerEnter(Collider Col)
    {
        if (Col.gameObject.tag.Equals("Player"))
        {
            GameObject Player = GameObject.FindGameObjectWithTag("Player");

            Player.GetComponent<Pawn>().m_bDead = true;

            Destroy(this.gameObject);
        }
    }
}
